<!--h5 -->
<div class="isH5 isPad nav_table">
  <a class="navbar-brand home" href="{{ i18n "main_home_logo" }}">
    <img src="{{ .Site.BaseURL }}{{ .Site.Params.logo }}" alt="{{ .Title }} logo" class="hidden-xs hidden-sm">
    <img src="{{ .Site.BaseURL }}{{ .Site.Params.logo_small }}" alt="{{ .Title }} logo" class="visible-xs visible-sm">
    <span class="sr-only">{{ .Title }} - {{ i18n "navHome" }}</span>
  </a>
  <ul class="topbar">
    <li class="search">
      <img src="/img/earth.svg">
      {{ range .Site.Menus.main }}
      {{ if eq .Identifier "lang" }}
      <a class="list" href="{{ .URL }}">{{ .Name }}</a>
      {{ end  }}
      {{ end  }}
      <i></i>
    </li>
    <li class="flex" onclick="getList('menu')" style="position:relative">
      <img src="/img/nav.svg" alt="Navigation">
    </li>
  </ul>
  <div id="nav">
    {{ range .Site.Menus.main }}
    {{ $currentId:= .Identifier }}
    {{ if ne $currentId "lang" }}
    {{ if .HasChildren }}
    <p class="second_menu" onclick="getList('#second_menu_{{ $currentId }}')">{{ .Name }}
      <i></i>
    </p>
    <div class="menu_list" id="second_menu_{{ $currentId }}">
      {{ range .Children }}
      <a class="list" href="{{ .URL }}">
        <p>{{ .Name }}</p>
      </a>
      {{ end }}
    </div>
    {{ else }}
    <a class="list" href="{{ .URL }}">
      <p>{{ .Name }}</p>
    </a>
    {{ end  }}
    {{ end  }}
    {{ end  }}
    <p class="second_menu" onclick="getList('#second_menu_repository')">
      <img style="width:18px;"src="{{ .Site.BaseURL }}img/gitee-logo.ico"><i></i>
    </p>
    <div class="menu_list" id="second_menu_repository" >
      <a class="list" href="https://gitee.com/openeuler">
        <p>{{i18n "main_nav_repository"}}</p>
      </a>
      <a class="list" href="https://gitee.com/src-openeuler">
        <p>{{i18n "main_nav_packageSources"}}</p>
      </a>
    </div>
    </p>
  </div>
</div>

<div class="isPc navbar-affixed-top" data-spy="affix" data-offset-top="67">

  <div class="navbar navbar-default yamm" role="navigation" id="navbar">

    <div class="container">
        <div class="navbar-header">
        <a class="navbar-brand home" href="{{ i18n "main_home_logo" }}">
            <img src="{{ .Site.BaseURL }}{{ .Site.Params.logo }}" alt="{{ .Title }} logo" class="hidden-xs hidden-sm">
            <img src="{{ .Site.BaseURL }}{{ .Site.Params.logo_small }}" alt="{{ .Title }} logo"
            class="visible-xs visible-sm">
            <span class="sr-only">{{ .Title }} - {{ i18n "navHome" }}</span>
        </a>
        <div class="navbar-buttons">
            <button type="button" class="navbar-toggle btn-template-main" data-toggle="collapse"
            data-target="#navigation">
            <span class="sr-only">{{ i18n "navToggle" }}</span>
            <i class="fa fa-align-justify"></i>
            </button>
        </div>
        </div>
        <!--/.navbar-header -->
        {{$curURL:= .RelPermalink}}
        {{$curDir:= substr $curURL 4}}
        <div class="navbar-collapse collapse" id="navigation">
        <ul class="nav navbar-nav navbar-right">
            {{ $current := . }}
            {{ range .Site.Menus.main }}
            {{ $topLevel := replace .URL "/" "" }}
            {{ $isChildren := false }}
            {{ range .Children }}
            {{ if eq .Identifier $current.Type }}
            {{ $isChildren = true }}
            {{ end }}
            {{ end }}
            {{ if ne .Identifier "lang" }}
            <li
            class="dropdown{{ if eq $current.RelPermalink .URL | or $isChildren | or (eq (trim $current.RelPermalink "/") $topLevel) | or (eq $current.Type .Identifier) | or (eq $current.Type $topLevel) | or (and (eq (default (trim .URL "/") .Identifier) "blog") (in (slice "taxonomy" "taxonomyTerm") $current.Kind)) }} active{{ end }}">
            {{ if .HasChildren }}
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
              aria-expanded="false">{{ .Name }} <span class="caret"></span></a>
            <ul class="dropdown-menu">
              {{ range .Children }}
              <li><a href="{{ .URL }}">{{ .Name }}</a></li>
              {{ end }}
            </ul>
            {{ else }}
            {{ if eq .Identifier "blog"}}
            <a href="{{ .URL }}">{{ .Name }}</a>
            {{ else }}
            <a href="{{ .URL }}">{{ .Name }}</a>
            {{ end }}
            {{ end  }}
            </li>
            {{ end }}
            {{ if eq .Identifier "lang" }}
            {{$newLan := .URL}}
            {{$newPath := (print $newLan "/" $curDir)}}
            {{$splitPath := split $curDir "/"}}
            {{$menu := first 1 $splitPath }}
            {{$docMenu := first 2 $splitPath }}
            {{$finalMenu := index $menu 0}}
            {{$finalDocMenu := index $docMenu 1}}

            {{if or (eq $finalMenu "blog") (eq $finalMenu "tags") (eq $finalMenu "archives")}}
            {{$newPath = (print $newLan "/blog.html")}}
            {{end}}

            {{if eq $finalMenu "events"}}
            {{$newPath = (print $newLan "/events.html")}}
            {{end}}

            {{if eq $finalDocMenu "20.03_LTS"}}
            {{$newPath = (print $newLan "/docs/20.03_LTS/docs/Quickstart/quick-start.html")}}
            {{end}}

            {{if eq $finalDocMenu "1.0_Base"}}
            {{$newPath = (print $newLan "/docs/1.0_Base/docs/Releasenotes/release_notes.html")}}
            {{end}}


            <li style="width:67px;text-align: center;"
            class=" dropdown{{ if eq $current.RelPermalink .URL | or $isChildren | or (eq (trim $current.RelPermalink "/") $topLevel) | or (eq $current.Type .Identifier) | or (eq $current.Type $topLevel) | or (and (eq (default (trim .URL "/") .Identifier) "blog") (in (slice "taxonomy" "taxonomyTerm") $current.Kind)) }} active{{ end }}">
            <a href="{{ $newPath }}">{{ .Name }}</a>  
            </li>
            {{ end }}
            {{ end }}
            <li style="width:67px;text-align: center;"class=""> 
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"><img style="width:18px;"src="{{ .Site.BaseURL }}img/gitee-logo.ico"><span class="caret"></span></a>
            <ul class="dropdown-menu">
            <li><a href="https://gitee.com/openeuler">{{i18n "main_nav_repository"}}</a></li>
            <li><a href="https://gitee.com/src-openeuler">{{i18n "main_nav_packageSources"}}</a></li>
            </ul>
        </li>    
        </li>   
        </ul>
        </div>
        <!--/.nav-collapse -->

        <div class="collapse clearfix" id="search">

        <form class="navbar-form" role="search">
            <div class="input-group">
            <input type="text" class="form-control" placeholder="Search">
            <span class="input-group-btn">

            <button type="submit" class="btn btn-template-main"><i class="fa fa-search"></i></button>

            </span>
            </div>
        </form>

    </div>
    <!--/.nav-collapse -->

    </div>
    </div>
    <!-- /#navbar -->

</div>

<!-- *** NAVBAR END ***-->